package com.csl.jsonpreference.test

import com.google.gson.annotations.SerializedName


enum class SerialType(var type: Int, var modename: String) {
    /**
     * 普通双侧轮车
     */
    @SerializedName("0")
    SOFTWARE_SERIAL(0, "软串口"),
    @SerializedName("1")
    HARDWARE_SERIAL0(1, "板载0号串口"),
    @SerializedName("2")
    HARDWARE_SERIAL1(2, "板载1号串口");


    companion object {
        fun getTypeForCode(typeCode: Int): SerialType {
            for (d in values()) {
                if (d.type == typeCode) {
                    return d
                }
            }
            return SOFTWARE_SERIAL
        }
    }

    override fun toString(): String {
        return "$name: $modename($type)"
    }


}